package bsi.vn.FirstApp;

import java.util.ArrayList;

import bsi.vn.Data.ErrorDetailAdapter;
import bsi.vn.Data.ErrorDetailData;
import bsi.vn.Lib.ProcessFunc;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.ListView;
import android.widget.TextView;

public class ErrorDetailActivity extends Activity {
	private ArrayList<ErrorDetailData> myErrorDetail = new ArrayList<ErrorDetailData>();
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_error_detail);
		Bundle extras = getIntent().getExtras();
		if (extras == null) {
			return;
		}	
		String loc_sErrorCode = extras.getString("ErrorCode");
		int loc_iErrorId = extras.getInt("ErrorId");
		
		TextView tvErrorCode = (TextView)findViewById(R.id.edtvErrorCode);
		tvErrorCode.setText(loc_sErrorCode);
		
		myErrorDetail = ProcessFunc.GetErrorDetailById(ErrorDetailActivity.this, loc_iErrorId);
		final ListView lv1 = (ListView) findViewById(R.id.edlvErrorDetail);
		lv1.setAdapter(new ErrorDetailAdapter(ErrorDetailActivity.this, myErrorDetail));
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		 MenuInflater menuInflater = getMenuInflater();
	        menuInflater.inflate(R.layout.menu, menu);
	        return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		startActivity(ProcessFunc.MenuAction(this, item));
		return true;
	}

}
